package com.kingdee.pda.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.kingdee.pda.R;
import com.kingdee.pda.entity.WarehouseLocation;
import com.kingdee.pda.util.CommonUtil;
import com.kingdee.pda.util.ViewHolder;

/**
 * 商品库位信息
 * Created by zhanlg
 * DATE 2021/5/27
 * TIME 9:33
 */
public class GoodsLocationsAdapter extends AbsBaseAdapter<WarehouseLocation> {

    public GoodsLocationsAdapter(Context context) {
        super(context);
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null){
            convertView = inflater.inflate(R.layout.adapter_item_goods_location, parent, false);
        }
        TextView tv_areaName = ViewHolder.get(convertView, R.id.tv_area_name);
        TextView tv_areaType = ViewHolder.get(convertView, R.id.tv_area_type);
        TextView tv_locationName = ViewHolder.get(convertView, R.id.tv_location_name);
        TextView tv_addSort = ViewHolder.get(convertView, R.id.tv_add_sort);

        WarehouseLocation location = getData().get(position);
        tv_areaName.setText(CommonUtil.formatEmptyString(location.getAreaName(), ""));
        tv_areaType.setText(location.getAreaTypeName(location.getAreaType()));
        tv_locationName.setText(CommonUtil.formatEmptyString(location.getLocationName(), ""));
        tv_addSort.setText(String.valueOf(location.getLaunchSort()));
        return convertView;
    }
}
